<?php
	
	require_once(EXTENSIONS . '/browser/lib/class.browserinfo.php');
	
	Class extension_browser extends Extension
	{

		public function about(){
			return array('name' => 'Browser',
						 'version' => '1.0',
						 'release-date' => '2009-02-14',
						 'author' => array('name' => 'Glue Interactive',
										   'website' => 'http://www.glue-interactive.com',
										   'email' => 'hello@glue-interactive.com')
				 		);
		}
	
	
		public function getSubscribedDelegates(){
			return array(
						array(
							'page' => '/frontend/',
							'delegate' => 'FrontendParamsResolve',
							'callback' => 'addParam'
						),									
					);
		}
		
		public function addParam($context)
		{
			$user = new BrowserInfo($_SERVER["HTTP_USER_AGENT"]);
						
			$context['params']['browser'] = $user->Browser;
			$context['params']['browser-version'] = $user->Browser_Version;
			$context['params']['platform'] = $user->OS;
			$context['params']['platform-version'] = $user->OS_Version;
		}
	}